<template>
	<view class="createoder">
		<image class="img" src="/static/tading/creare_order1.png"></image>
		<view class="black_1">
			创建订单
		</view>
		<view class="black_2">
			{{type == 0?'正在锁定订单金额请稍候...':'匹配成功'}}
		</view>
		<view class="black_3">
			购买流程
		</view>
		<view class="black_4">
			<view class="left">
				<view class="text1"></view>
				<view class="text2"></view>
			</view>
			<view class="right">
				<view class="text1">【订单状态】</view>
				<view class="text2">交易过程中实时留意订单状态，成交效率将影响您的信用评分</view>
			</view>
		</view>
		<view class="black_4">
			<view class="left">
				<view class="text1"></view>
				<view class="text2"></view>
			</view>
			<view class="right">
				<view class="text1">【确认交易】</view>
				<view class="text2">在您未确认售出给任意用户时，对方不会收到您的任何收款 信息，请及时确认</view>
			</view>
		</view>
		<view class="black_4">
			<view class="left">
				<view class="text1"></view>
				<view class="text2"></view>
			</view>
			<view class="right">
				<view class="text1">【确认收款】</view>
				<view class="text2">出售时，务必确认收到款项再进行打币，未按规定操作，平 台不承担任何责任</view>
			</view>
		</view>
		<view class="black_4">
			<view class="left">
				<view class="text1"></view>
				<view class="text2"></view>
			</view>
			<view class="right">
				<view class="text1">【确认收款】</view>
				<view class="text2">出售时，务必确认收到款项再进行打币，未按规定操作，平 台不承担任何责任</view>
			</view>
		</view>
		<view class="black_4">
			<view class="left">
				<view class="text1"></view>
				<view class="text2"></view>
			</view>
			<view class="right right2">
				<view class="text1">【交易完成】</view>
			</view>
		</view>
		
	<!-- 	<view class="black_5" v-if="type == 1">
			<view class="text1" @click="toUrl()">查看订单详情</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:0,
				timer:null,
				id:0,
				collection_id:0
			};
		},
		onLoad(opt) {
			this.id = opt.id
			this.collection_id =opt. collection_id
		},
		onShow() {
			this.timer = setInterval(this.valChange, 3000); // 注意: 第一个参数为方法名的时候不要加括号;	
		},
		methods:{
			valChange(){
				var data ={
					id:this.id,
					collection_id:this.collection_id
				}
				this.api.http.requests('exchange/buy', data, res => {
					console.log(11,res)
					this.type = 1
					clearInterval(this.timer);
					this.timer = null
					var userId = uni.getStorageSync('userId')
					this.custom.tool.jump(1, 'trading/MyTransaction?userId='+userId+"&id="+res.data.order_id)
				}, "POST")
			},
			toUrl(){
				// this.custom.tool.jump(0,'trading/MyTransaction?id'+)
			}
		},
		onUnload() {
			if(this.timer){
				clearInterval(this.timer);
				this.timer=null
			}
		}
	}
</script>

<style lang="less">

.createoder{
	text-align: center;
	.img{
		margin: 30px auto 10px auto;
		text-align: center;
		width: 320px;
		height: 150px;
	}
	.black_1{
		text-align: center;
		font-size: 35rpx;
		font-weight: 800;
		color: #262626;
		margin-top: 10px;
	}
	.black_2{
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
		margin-top: 10px;
	}
	.black_3{
		margin-top: 10px;
		font-size: 32rpx;
		font-weight: 800;
		color: #262626;
	}
	.black_4{
		display: flex;
		text-align: start;
		padding: 0px 10px ;
			// margin-top: 20px;
			border-left: 2rpx solid #ECECEC;
			.left{
				
				text-align: center;
				
				.text1{
					margin-top: 15px;
					width: 5px;
					height: 5px;
					border-radius: 50%;
					background: #989898;
				}
				.text2{
					margin: 0px auto;
					width: 1px;
					height: 100%;
					background: #F0F0F0
				}
			}
			
			.right{
				margin-left: 10px;
				font-size: 28rpx;
				font-weight: 400;
				color: #333333;
				padding: 10px 0px;
				border-bottom: 2rpx solid #ECECEC;
				.text2{
					margin-top: 5px;
					margin-left: 10px;
						font-size: 25rpx;
						font-weight: 400;
						color: #333333;
				}
			}
			.right2{
				border-bottom: 0rpx solid #ECECEC;
			}
	}
	
	.black_5{
		position: absolute;
		bottom: 10px;
		width: 100%;
		.text1{
				margin: 10px 10px;
				background: #FE903D;
				border-radius: 14rpx;
				padding: 10px;
				text-align: center;
				font-size: 35rpx;
				font-weight: bold;
				color: #FFFFFF;
		}
	}
}
</style>
